﻿String.prototype.trim = function () {
    return this.replace(/(^[\s]*)|([\s]*$)/g, "");
};
function testMail(idstr) {
    var myReg = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/;
    return myReg.test(idstr);
}
function GO(page) {
    document.getElementById("pageIndex").value = page;
    document.getElementById("_form").submit();
}

function SubmitForm(id) {
    document.getElementById(id).submit();
}
function toggle_visibility(id) {
    var e = document.getElementById(id);
    if (e.style.display == 'block')
        e.style.display = 'none';
    else
        e.style.display = 'block';
}
//屏蔽js错误
function ResumeError() {
    return true;
}
//window.onerror = ResumeError;
function onFocus(entity, m) {
    if (!document.all) {
        document.captureEvents(Event.KEYPRESS);
    }
    entity.onkeypress = function (e) {
        var key = document.all ? window.event.keyCode : e.which;
        if (key == 13)
            document.getElementById(m).submit();
    }
}

function Click(a) {
    window.location = "#";
    if (document.all) {
        document.getElementById(a).click();
    }
    else {
        var evt = document.createEvent("MouseEvents");
        evt.initEvent("click", true, true);
        document.getElementById(a).dispatchEvent(evt);
    }
}

String.prototype.replaceAll = function (s1, s2) {
    return this.replace(new RegExp(s1, "gm"), s2);
}    
